import os
import multiprocessing

# 1）进程间不共享全局变量
# 向list1中添加10个元素
def func(list1):
     for i in range(10):
          list1.append(i)
          print(os.getpid(), list1)

if __name__ == "__main__":
     list1 = []
     p1 = multiprocessing.Process(target=func, args=(list1,))
     p2 = multiprocessing.Process(target=func, args=(list1,))
     p1.start()
     p2.start()
     p1.join()
     p2.join()
     print(os.getpid(), list1)